package com.ruoyi.personnel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.personnel.domain.WorkExperience;
import com.ruoyi.personnel.mapper.WorkExperienceMapper;
import com.ruoyi.personnel.service.IWorkExperienceService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 工作经历Service业务层处理
 *
 * @author ruoyi
 * @date 2021-02-23
 */
@Service
public class WorkExperienceServiceImpl extends ServiceImpl<WorkExperienceMapper, WorkExperience> implements IWorkExperienceService {

    @Override
    public List<WorkExperience> queryList(WorkExperience workExperience) {
        LambdaQueryWrapper<WorkExperience> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(workExperience.getName())){
            lqw.like(WorkExperience::getName ,workExperience.getName());
        }
        if (StringUtils.isNotBlank(workExperience.getPersonnelId())){
            lqw.eq(WorkExperience::getPersonnelId ,workExperience.getPersonnelId());
        }
        if (StringUtils.isNotBlank(workExperience.getJobNumber())){
            lqw.eq(WorkExperience::getJobNumber ,workExperience.getJobNumber());
        }
        if (StringUtils.isNotBlank(workExperience.getStartTime())){
            lqw.eq(WorkExperience::getStartTime ,workExperience.getStartTime());
        }
        if (StringUtils.isNotBlank(workExperience.getEndTime())){
            lqw.eq(WorkExperience::getEndTime ,workExperience.getEndTime());
        }
        if (StringUtils.isNotBlank(workExperience.getWorkUnit())){
            lqw.eq(WorkExperience::getWorkUnit ,workExperience.getWorkUnit());
        }
        if (StringUtils.isNotBlank(workExperience.getDept())){
            lqw.eq(WorkExperience::getDept ,workExperience.getDept());
        }
        if (StringUtils.isNotBlank(workExperience.getPost())){
            lqw.eq(WorkExperience::getPost ,workExperience.getPost());
        }
        if (StringUtils.isNotBlank(workExperience.getWitness())){
            lqw.eq(WorkExperience::getWitness ,workExperience.getWitness());
        }
        if (StringUtils.isNotBlank(workExperience.getStatus())){
            lqw.eq(WorkExperience::getStatus ,workExperience.getStatus());
        }
        return this.list(lqw);
    }
}
